//
//  ZJKit.swift
//  Pods-ZJSwiftKit_Example
//
//  Created by zyx on 2023/2/16.
//

import Foundation


public struct ZJPrefix<Base> {
    /// Base object to extend.
    public let base: Base
    
    /// Creates extensions with base object.
    ///
    /// - parameter base: Base object.
    public init(_ base: Base) {
        self.base = base
    }
    
    
}

/// A type that has reactive extensions.
public protocol ZJPrefixProtocol { }

extension ZJPrefixProtocol {
    
    /// ZJPrefix extensions.
    public static var zj: ZJPrefix<Self>.Type {
        get{ ZJPrefix.self }
        set{ }
    }
    
    /// ZJPrefix extensions.
    public var zj: ZJPrefix<Self> {
        get{ ZJPrefix.init(self) }
        set {}
    }
}


// MARK: - 带有单个泛型的属性
public struct ZJSinglePrefix<Base, ZJT> {
    let base: Base
    init(_ base: Base) {
        self.base = base
    }
}

public protocol ZJSinglePrefixProtocal {
    associatedtype ZJT
}

public extension ZJSinglePrefixProtocal {
    static var zj: ZJSinglePrefix<Self, ZJT>.Type {
        get { return ZJSinglePrefix<Self, ZJT>.self }
        set {}
    }
    var zj: ZJSinglePrefix<Self, ZJT> {
        get { return ZJSinglePrefix(self) }
        set {}
    }
}

// MARK: - 带有多个泛型的属性-对应字典
public struct ZJMultiplePrefix<Base, ZJT1, ZJT2> {
    let base: Base
    init(_ base: Base) {
        self.base = base
    }
}

public protocol ZJMultiplePrefixProtocal {
    associatedtype ZJT1
    associatedtype ZJT2
}

public extension ZJMultiplePrefixProtocal {
    static var zj: ZJMultiplePrefix<Self, ZJT1, ZJT2>.Type {
        get { return ZJMultiplePrefix<Self, ZJT1, ZJT2>.self }
        set {}
    }
    var zj: ZJMultiplePrefix<Self, ZJT1, ZJT2> {
        get { return ZJMultiplePrefix(self) }
        set {}
    }
}


import Foundation

/// Extend NSObject with `zj` proxy.
extension NSObject: ZJPrefixProtocol { }

